From: Eshel Yaron Date: Sun, 16 Mar 2025 08:45:25 +0000 (+0100) Subject: Only disable 'completion-preview-active-mode' when it is on X-Git-Tag: archive/raspbian/1%30.2+1-2+rpi1^2~2^2~24^2~197 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22Program/%22http:/www.example.com/cgi/%22https:/%22Program?a=commitdiff_plain;h=b6b4a080a3abb5a45b680e26f93dd17adbb75f69;p=emacs.git Only disable 'completion-preview-active-mode' when it is on * lisp/completion-preview.el (completion-preview--post-command): Avoid calling 'completion-preview-active-mode' to disable the mode when already off, since it forces a costly redisplay. (Bug#76964) --- diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index 1c524985f05..ae1394d27b4 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el @@ -437,13 +437,17 @@ point, otherwise hide it." (cancel-timer completion-preview--timer) (setq completion-preview--timer nil)) - ;; If we're called after a command that itself updates the - ;; preview, don't do anything. - (unless internal-p - (if (and (completion-preview-require-certain-commands) - (completion-preview-require-minimum-symbol-length)) - (completion-preview--show) - (completion-preview-active-mode -1))))) + (cond + (internal-p + ;; `this-command' took care of updating the preview. Do nothing. + ) + ((and (completion-preview-require-certain-commands) + (completion-preview-require-minimum-symbol-length)) + ;; All conditions met. Show or update the preview. + (completion-preview--show)) + (completion-preview-active-mode + ;; The preview is shown, but it shouldn't be. Hide it. + (completion-preview-active-mode -1))))) (defun completion-preview-insert () "Insert the completion candidate that the preview is showing."